insheet using ../Data/Raw/raw_pairwise_recruiter.csv, comma names clear
g absorbconstant=1
drop if screenerid1==screenerid2
drop if hiringmanagerid1 != hiringmanagerid2

gen pair_id=string(screenerid1)+"-"+string(screenerid2)
replace pair_id=string(screenerid2)+"-"+string(screenerid1) if screenerid2>screenerid1
gen ratertwoeval=1

label var ppassinterview1 "\Centerstack{P(Passes\! Interview)\! Eval \#1}"
label var pacceptinterview1 "\Centerstack{P(Accepts\! Interview)\! Eval \#1}"
label var pacceptjoboffer1 "\Centerstack{P(Accepts\! Offer)\!Eval \#1}"
label var ratertwoeval "Second Evaluator"
label var interview1 "\Centerstack{Interview\!Eval \#1}"

foreach var in pacceptinterview1 pacceptinterview2 ppassinterview1 ppassinterview2 pacceptjoboffer1 pacceptjoboffer2 interview1 interview2 {
	egen `var'_std=std(`var')
}

replace ratertwoeval=pacceptinterview2
reghdfe pacceptinterview1_std ratertwoeval, absorb(absorbconstant) cluster(pair_id)
	eststo one 

replace ratertwoeval=ppassinterview2
reghdfe ppassinterview1 ratertwoeval, absorb(absorbconstant) cluster(pair_id)
	eststo three 

replace ratertwoeval=pacceptjoboffer2
reghdfe pacceptjoboffer1 ratertwoeval, absorb(absorbconstant) cluster(pair_id)
	eststo two 

replace ratertwoeval=interview2
reghdfe interview1 ratertwoeval, absorb(absorbconstant) cluster(pair_id)
	eststo four 

global myopts "bf(%15.2gc) sfmt(%15.2gc) prehead(\begin{tabular}{l*{14}{c}}) postfoot(\end{tabular}) se label noisily noeqlines varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01) replace"
esttab one two three four using ../Output/Tables/Appendix/TableB03.tex, $myopts keep(ratertwoeval) stat(N r2, label("\hline Observations" \(R^{2}\)))
